package com.getpebble.android.font;

import android.content.Context;
import android.graphics.Typeface;
import com.sun.mail.imap.protocol.ListInfo;
import com.sun.mail.smtp.SMTPMessage;
import java.lang.ref.WeakReference;

public class PblFont {
    public static final Integer DEFAULT_FONT_TYPE = Integer.valueOf(FontType.REGULAR.ordinal());
    private static WeakReference<Typeface> fontBold = null;
    private static WeakReference<Typeface> fontLight = null;
    private static WeakReference<Typeface> fontRegular = null;

    static /* synthetic */ class AnonymousClass1 {
        static final /* synthetic */ int[] $SwitchMap$com$getpebble$android$font$PblFont$FontType = new int[FontType.values().length];

        static {
            try {
                $SwitchMap$com$getpebble$android$font$PblFont$FontType[FontType.BOLD.ordinal()] = 1;
            } catch (NoSuchFieldError e) {
            }
            try {
                $SwitchMap$com$getpebble$android$font$PblFont$FontType[FontType.LIGHT.ordinal()] = 2;
            } catch (NoSuchFieldError e2) {
            }
            try {
                $SwitchMap$com$getpebble$android$font$PblFont$FontType[FontType.REGULAR.ordinal()] = 3;
            } catch (NoSuchFieldError e3) {
            }
        }
    }

    public enum FontType {
        BOLD,
        LIGHT,
        REGULAR
    }

    public static Typeface getFontType(Context context, Integer fontTypeInt) {
        try {
            switch (AnonymousClass1.$SwitchMap$com$getpebble$android$font$PblFont$FontType[FontType.values()[fontTypeInt.intValue()].ordinal()]) {
                case SMTPMessage.RETURN_FULL /*1*/:
                    return getFontBold(context);
                case SMTPMessage.RETURN_HDRS /*2*/:
                    return getFontLight(context);
                case ListInfo.INDETERMINATE /*3*/:
                    return getFontRegular(context);
                default:
                    return Typeface.DEFAULT;
            }
        } catch (Exception e) {
            return Typeface.DEFAULT;
        }
        return Typeface.DEFAULT;
    }

    public static Typeface getFontRegular(Context context) {
        if (fontRegular == null || fontRegular.get() == null) {
            fontRegular = new WeakReference(Typeface.createFromAsset(context.getAssets(), "fonts/PFDinDisplayPro_Reg.ttf"));
        }
        return (Typeface) fontRegular.get();
    }

    public static Typeface getFontBold(Context context) {
        if (fontBold == null || fontBold.get() == null) {
            fontBold = new WeakReference(Typeface.createFromAsset(context.getAssets(), "fonts/PFDinDisplayPro_Bold.ttf"));
        }
        return (Typeface) fontBold.get();
    }

    public static Typeface getFontLight(Context context) {
        if (fontLight == null || fontLight.get() == null) {
            fontLight = new WeakReference(Typeface.createFromAsset(context.getAssets(), "fonts/PFDinDisplayPro_Light.ttf"));
        }
        return (Typeface) fontLight.get();
    }
}
